package com.mymarkdown.app.fx.event.hander.impl;

import com.mymarkdown.app.fx.event.hander.MenuHandler;
import com.mymarkdown.app.fx.event.model.FxEvent;
import com.mymarkdown.app.util.FxShowWindowUtil;
import javafx.scene.web.WebEngine;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author zenglun
 * @date 2021/12/15 2:10 下午
 * @description: TODO
 */
@Slf4j
@Component
public class ExplainMenuHandlerImpl implements MenuHandler {
    @Value("${fx.app.explain.page}")
    private String explainPage;

    @Value("${fx.app.explain.title}")
    private String explainTitle;

    @Value("${fx.app.explain.min-height}")
    private Integer minHeight;

    @Value("${fx.app.explain.min-width}")
    private Integer minWidth;

    @Override
    public void handler(WebEngine engine, FxEvent event) {
        FxShowWindowUtil.empty(explainPage).setTitle(explainTitle)
                .setMinHeight(minHeight)
                .setMinWidth(minWidth)
                .showWindow();
    }
}
